import os
progname='baoya'
saoma_port = 51236
saoma_ip = '192.168.1.150'

confdef = {
    # thd_conf 
    #'kakouok': ['thd_conf', 50, 0, 100, 'ok阈值'],
    #'kakoung': ['thd_conf', 60, 0, 100, 'ng阈值'],
    'saoma_match_wait': ['thd_conf', 20, 0, 100, '条码延迟匹配(0.1秒)'],

    # chk_conf
    'stopline': ['chk_conf', 0, '开启开启检测停线'],
    'scadastopline': ['chk_conf', 0, '开启scada停线'],
    'upimgs': ['chk_conf', 0, '开启传图'],
    'use_scada': ['chk_conf', 0, '开启scada'],
}

camnames_ips = [
    '1.保压 0 192.168.1.100 ptcluoding',
]

def jiaodu_trans(x):
    x = x.replace('逆', '-').replace('顺', '+')
    x = int(x)
    return x

camnames_ips = [s.split() for s in camnames_ips]
camnames = [s[0] for s in camnames_ips]
id2index = {}
for index, x in enumerate(camnames):
    id = x.split('.')[0]
    id2index[id] = index
cam_rot = [jiaodu_trans(s[1]) for s in camnames_ips]
cam_ips = [s[2].split('.')[-1] for s in camnames_ips]
quexians = [s[3].split('+') for s in camnames_ips]

config = {
    "captype": "hk",
    'password': '',
    "usbcamid": 1,
    "stopline_time": 15,
    'ips': cam_ips,
    'camnames': camnames,
    "ncams": 1,
    "oktext": "12345",
    "comid": "COM3",
    "saveimg": 1,
    "onlycapimg": 0,
    "use_pic_test": 1,
    "stopline": 1,  #1stop 0run
    "skip": 0,
    "myip":'10.177.104.98',
    'conf_thres': 0.4,
    'iou_thres': 0.1,
    'crop_num': 3,
    'imgsz': 512,
    'qutu_num': 8,
    'progname': 'baoya',
    'classname': '装配结构检验',
    'out_img_p': 'D:/data/save',
    'id':'0000',
    "errcode": "V4-NHJHL12"
}


pa = 'D:/data/220401小鸟/'
pa = 'D:/data/220401小鸟/220609/PO69051不良'
pa = 'D:/data/220401小鸟/220803不良品'
pa = 'E:/data/221015风轮间隙/2022-10-15'
pa = 'D:/data/2210301蜗壳卡扣/卡扣工位/卡扣图片（包含OK,NG）'
pa = 'D:/data/2210301蜗壳卡扣/卡扣工位/卡扣ng图片'
pa = 'D:/data/221101螺钉有无/ptc螺钉/20221108'
pa = 'D:/data/221101螺钉有无/nei1_luoding2PTC'
pa = 'D:/data/221101螺钉有无/内二PTC螺钉-ok'
pa = 'D:/data/221115保压/train_baoya'

pa = pa if os.path.exists(pa) else 'E:/data/221101螺钉有无/nei1_luoding2PTC'
pa = pa if os.path.exists(pa) else 'D:/data/xiaoniao'
pa = pa if os.path.exists(pa) else 'E:/OK/camera3/2022-10-17/511223963132A170310138'
pp = [
    f'{pa}/变形',
    f'{pa}/毛丝6',
]
pp = [
    f'{pa}/变形',
    f'{pa}/变形',
]
pp = {
    '100':f'{pa}',
}
